package com.example.chandao.services.impl;

import com.example.chandao.mapper.ResearchUserMapper;
import com.example.chandao.pojo.BugTypeStatistics;
import com.example.chandao.pojo.ResearchUser;
import com.example.chandao.pojo.ResearchUserBug;
import com.example.chandao.pojo.ResearchUserTask;
import com.example.chandao.services.ResearchUserService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ResearchUserServiceImpl implements ResearchUserService {

    @Resource
    private ResearchUserMapper researchUserMapper;

    @Override
    public List<ResearchUser> getAllResearchUsersData(ResearchUser researchUser) {
        if(researchUser.getIsSearch() != null && researchUser.getIsSearch() == 2){
            return researchUserMapper.getAllTestUserDatas(researchUser);
        }else {
            return researchUserMapper.getAllResearchUserDatas(researchUser);
        }
    }

    @Override
    public List<ResearchUserBug> getResearchUsersBugData(ResearchUser researchUser) {
        if(researchUser.getIsSearch() != null && researchUser.getIsSearch() == 2){
            return researchUserMapper.getTestUserBugData(researchUser);
        }
        return researchUserMapper.getResearchUserBugData(researchUser);
    }

    @Override
    public List<ResearchUserTask> getResearchUsersTaskData(ResearchUser researchUser) {
        List<ResearchUserTask> researchUserTaskData = researchUserMapper.getResearchUserTaskData(researchUser);
        for (ResearchUserTask researchUserTask : researchUserTaskData) {

        }
        return researchUserMapper.getResearchUserTaskData(researchUser);
    }

    @Override
    public List<ResearchUser> getResearchUser(ResearchUser researchUser) {
        return researchUserMapper.getResearchUser(researchUser);
    }

    @Override
    public List<BugTypeStatistics> getBugTypeStatistics(ResearchUser researchUser) {
        return researchUserMapper.getBugTypeStatistics(researchUser);
    }
}
